cmake_minimum_required(VERSION 2.8.9)

project(real)

add_subdirectory(base)
add_subdirectory(add)

option(USE_OUT_ADD "use outside add library" OFF)

if (USE_OUT_ADD)
    set(EXTRA_INCLUDES ${EXTRA_INCLUDES} "${PROJECT_SOURCE_DIR}/../ar_proj/include")
    set(EXTRA_LIBS ${EXTRA_LIBS} "${PROJECT_SOURCE_DIR}/../ar_proj/build/libadd.a")
else ()
    set(EXTRA_INCLUDES ${EXTRA_INCLUDES}  "${PROJECT_SOURCE_DIR}/add")
    set(EXTRA_LIBS ${EXTRA_LIBS} add)
endif (USE_OUT_ADD)

configure_file(
    "${PROJECT_SOURCE_DIR}/config.h.in"
    "${PROJECT_BINARY_DIR}/config.h"
)
include_directories("${PROJECT_BINARY_DIR}")


file(GLOB SOURCES "*.cpp")
add_executable(main ${SOURCES})


target_link_libraries(main PUBLIC base ${EXTRA_LIBS})

target_include_directories(main PUBLIC 
        "${PROJECT_SOURCE_DIR}/base"
        "${EXTRA_INCLUDES}"
        )

#dynamic lib include & lib
#include_directories(../so_proj/include)
#link_directories(../so_proj/build)
#set(PROJECT_LINK_LIBS libadd.dylib)

#static lib include & lib
#include_directories(../ar_proj/include)
#link_directories(../ar_proj/build)
#set(PROJECT_LINK_LIBS libadd.ar)



